#pragma once

#include <vector>
#include <OSLog.h>
using namespace std;

#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))

class CheckPoint {
    private:
        vector<int> mExpect;
        vector<int> mActual;

    public:
        void add(int check) {
            mActual.push_back(check);
        };

        void setCheckPoint(int* points, int count) {
            for(int i=0; i<count; i++) {
                mExpect.push_back(points[i]);
            }
        };

        void dump() {
            OS_LOG("expect step:[");
            for (long unsigned int i=0; i<mExpect.size(); i++) {
                OS_LOG("%d", mExpect[i]);
                if (i != mExpect.size()-1) {
                    OS_LOG(", ");
                }
            }
            OS_LOG("]\n");

            OS_LOG("actual step:[");
            for (long unsigned int i=0; i<mActual.size(); i++) {
                OS_LOG("%d", mActual[i]);
                if (i != mActual.size()-1) {
                    OS_LOG(", ");
                }
            }
            OS_LOG("]\n");

        }

        bool verify() {
            if (mActual.size() != mExpect.size()) {
                OS_LOG("actiual size %ld not equal with expect %ld\n", mActual.size(), mExpect.size());
                dump();
                return false;
            }

            for (long unsigned int i=0; i<mExpect.size(); i++) {
                if (mActual[i] != mExpect[i]) {
                    OS_LOG("can not find step %d\n", mActual[i]);
                    dump();
                    return false;
                }
            }
            return true;
        };

        void clean() {
            mActual.clear();
            mExpect.clear();
        };

};


